home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Compute! Gazette 1993 January
/
1993-01.d64
/
total sort
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-09-20
|
16KB
|
545 lines
5 rem modified 12/27/91
7 rem for printers with auto paging delete lines 2720-2740 and remove pokes
8 rem from lines 2810 & 2850
10 rem this version requires mlswap.obj
20 rem & screen.obj to be loaded 1st
30 poke53281,0:poke53280,11
40 print"[147]totalizer"
50 print"by"
60 print"randy clemmons"
70 rem initialize variables
80 dim nc,ad,da,fs,sn,yn$,ju$,mu$,er,f$,sb,fl$,en,em$,et,es,ta,av,at,rs:dc=1
90 dim i,sf,ss$,cl,vf,hn,x,tr,df,x$,sl,w,c$,l,sp$,ca$,in,tn,ts,te,tx,af,j,dt$
100 dim lg,lk,cr$,hd$,hd,pa,j$,le,lt,ps,sh,ns,k,di,db,dq,n,tp,ub,lb,te$,tb$,nd%
105 dim mc,lm$:dv=4
110 dim cb,ck,p1,p2,ve,ao,yn,vf$,ve$,ta$,i$,tm,rm$,sc:dc=1:nc=1:lm=15:rm=60
120 print"copyright 1993"
130 gosub3440:dimd$(503):dima$(503):fs=1:sn=1:d$(0)="":a$(0)="":goto1270
140 err=0:if d$(1)="" then gosub3370:return
150 print"[158][147] save and replace file"
155 print" return to menu return [146]"
160 print" file directory ^ or $ [146]"
170 print""spc(28)"save":f$=""
180 printspc(27)"[207][183][183][183][183][208]
190 [153][166]27)"sgn (NULL)right$ +
200 printspc(27)"[180] [202][203] [170]
210 [153][166]27)"sgn then +
220 printspc(27)"[183][183][183][183][183][183]":ifsb=1thensb=0:return
230 input" save file name";f$
240 if f$="" then return
250 iff$="^" then poke52233,6:gosub3260:goto150
255 iff$="$" then poke52233,1:gosub3260:goto150
260 print"saving ";f$
270 open15,8,15,"i0":gosub610
280 open2,8,2,"@0:"+f$+",s,w":gosub610: cr$=chr$(13):if err=1 then140
290 print#2,str$(nc)cr$;str$(ta)cr$;str$(sn)cr$;str$(dc)cr$;str$(av)cr$;str$(at)
300 for i=1 to 500 step 3
310 print#2,d$(i)","a$(i)cr$;d$(i+1)","a$(i+1)cr$;d$(i+2)","a$(i+2)cr$;
320 if d$(i+2)="" then i=512
330 next i:gosub610
340 close 2:close15:sf=1:fs=1
350 return
360 if d$(1)="" goto390
370 if fs=1 then goto390
380 print"[147]":gosub3300:if yn$="y" then return
390 err=0:print"[159][147] return to menu return [146]"
400 print" file directory ^ or $ [146]"
410 print""spc(28)"load":f$=""
420 sb=1:gosub180
430 input" load file name";f$
435 if f$="" then return
440 iff$="^" then poke52233,6:gosub3260:goto390
445 iff$="$" then poke52233,1:gosub3260:goto390
460 fl$="0:"+f$+","+"s,r"
470 print"reading ";f$
480 open15,8,15,"i0":gosub610:open2,8,2,fl$:gosub610
485 iferr=1then close2:close15:goto390
490 input#2,nc,ta,sn,dc,av,at:rs=st:gosub610
500 for i=1 to 500 step 4 :rem gosub7000
510 input#2,d$(i),a$(i),d$(i+1),a$(i+1),d$(i+2),a$(i+2),d$(i+3),a$(i+3)
520 rs=st:gosub610:ifd$(i)=""then i=512
530 if rs=64 then560
540 if rs<>0 then590
550 next i
560 close 2:close15
570 sf=1:fs=1
580 return
590 print"bad disk status is "rs
600 close 2
610 en=0:input#15,en,em$,et,es
620 if en=0 then return
630 print"error on disk"
640 printen;em$;et;es
650 close 2:close15
660 fort=1to900:nextt:err=1:return
670 print "[147]create new file"
680 if d$(1)="" then 701
690 if fs=1 then 701
700 gosub3300:if yn$="y" then return
701 print"[155] options ? [161]y/n[182][146]"
702 gosub3330:if yn$="y" then 710
705 print"[147]":goto 800
710 x=0:print"[147]"spc(15)"[159]options":if mu$="n" then at=0
715 print"[155]enter amounts only ";
716 yn=ao:gosub4840:ao=yn
720 print"[155]commas in descriptions ";
730 yn=nc:gosub4920:nc=yn
740 print"compute taxes for total ";
745 ifta>1thenta=1
750 yn=ta:gosub4840:ta=yn
754 ifyn=0then 760
755 dc=1:print"percentage ";ta$
756 input"[145]";ta$:ta=val(ta$):goto780
760 print"use integers with amounts";
770 yn=dc:gosub4920:dc=yn
780 print"compute average amount ";
790 yn=av:gosub4840:av=yn
800 print"[155]":fs=0:ifca$="o"then return
805 print"[147]"
810 at=0:for i=1 to 500:d$(i)="":a$(i)="":print"item no. ";i
815 if ao=1 then d$(i)="":goto 860
820 rem if nc=0 then poke631,34:poke198,1
830 cl=peek(214):input"description";d$(i)
840 lk=peek(214):if lk-cl>2 then gosub3390:goto820
850 if d$(i)="" then sn=i:i=512:goto880
860 gosub3410:x=0:x$=""
861 input"amount";x$:x=val(x$)
863 ifdc=0thenat=at+int(x):goto867
865 at=at+x
867 if ao=1 then if x$="" then sn=i:d$(i)="":i=512:goto880
868 gosub3640:a$(i)=x$
870 x=at:gosub3640:print"total=";x$;"[182]
880 [130] i
890 [153] "finished":fs[178]0
900 [137]1130
910 [143] swap out commas w/semi colons
920 [139] d$(1)[178]""[167] [142]
940 [151]50949,44:[151]50950,59:[158]50951:sf[178]1:[142]
950 [143] swap out semi colons w/commas
960 [151]50949,59:[151]50950,44:[158]50951:sf[178]0:[142]
970 ss$[178]" ":cl[178]0:d$(501)[178]""
980 [139] d$(1)[178]"" [167] [141]3370:[142]
990 vf[178]1:hn[178]sn[171]1:[153]"loadlast no. is ";hn
1000 [153]"start viewing from item no. 1"
1010 [139] nc[178]1 [167]1030
1015 [141]950
1020 [139] sf[178]1 [167] [141]950
1030 [133]"on";vf$:vf[178][197](vf$)
1031 [139] vf[179]1 [167] 1030
1032 [139] vf[177]hn [167] 1030
1040 [139][194](214)[177]8[167]pk[178]1024[170]([194](214)[172]40)[171]7:[129]i[178]0[164]2:[151]1337[170]i,[194](pk[170]i):[130]i
1050 [139][194](1337)[178]32[167][151]1337,49
1060 [139] vf[177]hn [167] [153]"loadhighest no. is ";hn:[129]t[178]1[164]600:[130]t:[137]1000
1070 [151]51153,0:[139] vf[177]255 [167] [151]51153,1:[151]51153,vf[171]256:[137]1090
1080 [151]51152,vf
1090 [151]51154,0:[143] reset return flag
1100 [158]51200:[143] ml screen routine
1110 [139] [194](51154)[178]1 [167] [142]
1120 [139] [194](51154)[178]0 [167] x[178]at:[141]1200
1130 [153]" <any key to return>":[141]3620
1140 [161] sp$:[139] sp$[178]"" [167]1140
1150 [142]
1160 [141]3640
1170 [139] ca$[178]"v"[167]1190
1180 [139] mu$[179][177]"v"[167] [142]
1190 [153] [166]39[171]l);"on";x$:[142]
1200 [139] ta[178]0 [167]1230
1210 tx[178]x:[141]1260:[153]" subtotal":[141]1160:[141]1260:[153]" taxes";
1220 [153]" ";ta;"cmd%":x[178]x[172](ta[172].01):[141]1160:x[178]tx[170]x
1230 [141]1260:[153]" total":[141]1160
1240 [139] av[178]1 [167] [141]1260:[153]" average":x[178]x[173](sn[171]1):af[178]1:[141]1160
1250 [142]
1260 [153] [166]29);"----------":[142]
1270 [153]"load menu":yn$[178]""
1280 [153]"list tototo totototototototo "
1290 [153]" n.wait new filewait"
1300 [153]"sys tototo tototototototototo "
1310 [153]" s.wait save filewait"
1320 [153]"open tototo tototototototototo "
1330 [153]" l.wait load filewait"
1340 [153]"list tototo tototototototototo "
1350 [153]" v.wait view filewait"
1360 [153]"print tototo tototototototototo "
1370 [153]" e.wait edit filewait"
1380 [153]"cont tototo totototototototototo "
1390 [153]" p.wait print filewait"
1400 [153]"list tototo tototototototototototototo "
1410 [153]" x.wait exit to basicwait":[141]3620
1420 [161] mu$:[139] mu$[178]"" [167]1420
1430 [139] mu$[178]"n" [167] [141]670:[137]1270
1440 [139] mu$[178]"s" [167] [141]4000:[141]920:[141]140:[137]1270
1450 [139] mu$[178]"l" [167] [141]4000:[141]360:[137]1270
1460 [139] mu$[178]"v" [167] [141]970:[137]1270
1470 [139] mu$[178]"e" [167] [141]1550:[137]1270
1480 [139] mu$[178]"p" [167] [141]2610:[137]1270
1490 [139] mu$[178]"x" [167]1510
1500 [137]1420
1510 [139] d$(1)[178]"" [167] [153]"load":[128]
1520 [139] fs[178]1 [167] [153]"load":[128]
1530 [153]"load":[141]3300:[139] yn$[178]"y" [167]1270
1540 [139] yn$[178]"n"[167] [153]"loadlist":[128]
1550 [139] d$(1)[178]"" [167] [141]3370:[142]
1560 [153] "printload file editor"
1565 [139] nc[178]0 [167] [141]950
1567 [139] nc[178]1 [167] [141]910
1570 [153] [166]14)"to
1580 print spc(14)"a[146]dd to
1590 [153] [166]14)"to
1600 print spc(14)"c[146]hange
1610 [153] [166]14)"to
1620 print spc(14)"d[146]elete
1630 [153] [166]14)"to
1640 print spc(14)"i[146]nsert
1650 [153] [166]14)"to
1660 print spc(14)"m[146]ove
1670 [153] [166]14)"to
1680 print spc(14)"o[146]ptions
1690 [153] [166]14)"to
1700 print spc(14)"s[146]ort
1710 [153] [166]14)"to
1720 print spc(14)"r[146]eturn
1730 [153] [166]14)"to
1740 print spc(14)"v[146]iew
1750 [153] [